<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>阶乘函数--递归调用</title>
</head>
<body>
	<script>
		function x(n){
			if (n===1){
				return 1;
			}else{
				return n * x(n-1);
			}
		}

		// 1*2*3*4*5
		console.log(x(5));

		// 1*2*3*4*5*6*7
		console.log(x(7));

		// 1*2*3*4*5*6*7*8
		console.log(x(8));

	</script>
</body>
</html>